package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.model.User;
import com.zr.service.Tjsqservice;
import com.zr.serviceImpl.TjsqserviceImpl;

public class TjsqController extends HttpServlet{
             Tjsqservice t=new TjsqserviceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	       String edata= req.getParameter("edata");
	       String etartday=  req.getParameter("etartday");
	        int actualday=Integer.parseInt(req.getParameter("actualday"));
	        String category = req.getParameter("category");
	         String reason=req.getParameter("reason");
	        String opinion=req.getParameter("opinion");
	        String remake= req.getParameter("remake");
	        HttpSession session=req.getSession();
	         User u=(User) session.getAttribute("user");
	       boolean b=  t.findtjsq(edata, etartday, actualday, category, reason, opinion, u.getUsernum(), remake);
	         PrintWriter pw=resp.getWriter();
	         if(b){
	        	 pw.write("true");
	         }else{
	        	 pw.write("false");
	         }
	  
	         
	
	}
  
}
